import Vue from 'vue';
import VueI18n from 'vue-i18n';
import locale from 'element-ui/lib/locale'; // elementUI的国际化
import elementEnLocale from 'element-ui/lib/locale/lang/en'; // element-ui lang
import elementZhLocale from 'element-ui/lib/locale/lang/zh-CN';// element-ui lang

import zeeiEnLocale from '../../components/locale/lang/en.js'; // zeei-components lang
import zeeiZhLocale from '../../components/locale/lang/zh.js';// zeei-components lang

import zhLocale from './zh.js';
import enLocale from './en.js';
const defaultlanguage = window.localStorage.getItem('language') || 'zh';
Vue.use(VueI18n);
const i18n = new VueI18n({
  locale: defaultlanguage,
  messages: {
    en: {
      ...enLocale,
      ...elementEnLocale,
      ...zeeiEnLocale
    },
    zh: {
      ...zhLocale,
      ...elementZhLocale,
      ...zeeiZhLocale
    }
  }
});
locale.i18n((key, value) => i18n.t(key, value)); // elementui多语言切换
export default i18n;
